<?php
class Payment{
     
   public $type='';
   public $option=array();
   
   public function __construct($type='',$option=array()){
       $this->type=$type;
       $this->option=$option;
   }
    
   public function getInstance(){
         $path=LIB_PATH.'payment/'.$this->type.'.class.php';
         if(is_file($path))  {
             include $path;
             $pay=$this->type;
             return new $pay($this->option);
         }else{
             throw new Exception($this->type.'支付方式不存在');
         }
    }
}